package cn.sinecure.service.impl;

import cn.sinecure.mapper.UserMapper;
import cn.sinecure.pojo.User;
import cn.sinecure.service.UserService;
import io.swagger.v3.oas.annotations.servers.Server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public User selectUserByName(String name, String password) {
        User user = userMapper.getUserByName(name);
        if(user==null){
            return null;
        }
        String passwordHash = user.getPasswordHash();
        if(!passwordHash.equals(password)){
            return null;
        }
        return user;
    }
}
